<!DOCTYPE html>
<html xmlns:th= "http://www.thymeleaf.org"  xmlns:data= "http://www.w3.org/1999/xhtml" >

<head>
    <meta http-equiv="Content-Type" content="text/html;charset= UTF-8" >
    <title>Title</title>
</head>
<head th:include= "include/include" >
</head>
<style>
    input{
        width:215px;
    }

</style>
<body>
    <form role='form' id="addpartsform" action="" method="post">
         <div >
             <input class='control-label' style="display: none;" name="ids" value="" id="ids"></input>
             <label class='form-group'>
                <label class='control-label'>险种名称：</label>
                <label class='control-label'><select style='width:215px;'class='form-control ' name="insuranceTypeName" id="insuranceTypeName"><option value='1'>险种1</option><option value='2'>险种2</option></select></label>
             </label>
             <label class='form-group'>
                 <label class='control-label'>配件名称：</label>
                 <label class='control-label'><input type='text' class='form-control' id='partsName' name="partsName" style='width:215px;'></label>
             </label>
         </div>
         <div >
             <label class='form-group'>
             <label class='control-label'>本地价格：</label>
             <label class='control-label'><input type='text' class='form-control' id='localPrice' name="localPrice"  style='width:215px;'></label>
             </label>
             <label class='form-group'>
             <label class='control-label'>系统价格：</label>
             <label class='control-label'><input type='text' class='form-control' id='systemPrice' name="systemPrice"  style='width:215px;'></label>
             </label>
         </div>
         <div >
             <label class="form-group">
                <label class='control-label'>价格方案：</label>
                <label class='control-label'><input type='text' class='form-control' id='pricePaln' name="pricePlan"  style='width:215px;'></label>
             </label>
             <label class="form-group">
                 <label class='control-label' style="width:60px;">数量：</label>
                <label class='control-label'><input type='text' class='form-control' id='count' name='count' style='width:215px;'></label>
             </label>
         </div>
         <div >
             <label class="form-group">
             <label class='control-label'>核价价格：</label>
             <label class='control-label'><input type='text' class='form-control' id='checkPricePrice' name="checkPricePrice"  style='width:215px;' ></label>
             </label>
             <label class="form-group">
             <label class='control-label' style="width: 60px;">定损价：</label>
             <label class='control-label '><input type='text' class='form-control' id='fixedLossPrice' name="fixedLossPrice"  style='width:215px;' oninput = "value=value.replace(/[^\d]/g,'')"></label>
             </label>
         </div>
         <div class='form-group'>
             <label class='control-label'style="width:60px;">状态：</label>
             <label class='control-label'><select style='width:215px;'class='form-control ' name="status" id="status"><option value='1'>完成</option><option value='0'>未完成</option></select></label>
             <label class='control-label'>是否回收：</label>
             <label class='control-label'><select style='width:215px;'class='form-control ' name="isRecycle" id="isRecycle"><option value='1'>是</option><option value='0'>否</option></select></label>
         </div>
        <!--<div>
            <label> <button onclick="save1();"> 保存</button></label>
        </div>-->
        <!--<div>-->
            <!--<lable class="control-label"><input  type="button" value="保存" id="save"/> </lable>-->
        <!--</div>-->
     </form>
<script>
    $(function(){
        formValidator();

    })
    function save1(){
        console.log($('#addpartsform').data('bootstrapValidator').validate())
        console.log($('#addpartsform').data('bootstrapValidator').isValid())

    }
    //初始化表单
    function formValidator() {
        $("#addpartsform").bootstrapValidator(
            {
                live: "enabled", /*验证时机，enabled是内容有变化就验证（默认），disabled和submitted是提交再验证*/
                message: "通用的验证失败信息",
                feedbackIcons: {//根据验证结果显示的各种图标
                    valid: 'glyphicon glyphicon-ok',
                    invalid: 'glyphicon glyphicon-remove',
                    validating: 'glyphicon glyphicon-refresh'
                },
                fields: {
                    fixedLossPrice: {
                        message: ' ',
                        validators: {
                            notEmpty: {
                                message: ' '
                            },
                            regexp:{
                                regexp:/^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/,
                                message:' '
                            },
                            lessThan: {/*最大值*/
                                value : 10000000,
                                message : ' '
                            }

                        }
                    },
                    checkPricePrice: {
                        message: ' ',
                        validators: {
                            notEmpty: {
                                message: ' '
                            },
                            regexp:{
                                regexp:/^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/,
                                message:' '
                            },
                            lessThan: {/*最大值*/
                                value : 10000000,
                                message : ' '
                            }

                        }
                    },
                    localPrice:{
                        message: ' ',
                        validators: {
                            notEmpty: {
                                message: ' '
                            },
                            regexp:{
                                regexp:/^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/,
                                message:' '
                            },
                            lessThan: {/*最大值*/
                                value : 10000000,
                                message : ' '
                            }

                        }
                    },
                    systemPrice:{
                        message: ' ',
                        validators: {
                            notEmpty: {
                                message: ' '
                            },
                            regexp:{
                                regexp:/^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/,
                                message:' '
                            },
                            lessThan: {/*最大值*/
                                value : 10000000,
                                message : ' '
                            }

                        }
                    },
                    pricePlan:{
                        message: ' ',
                        validators: {
                            notEmpty: {
                                message: ' '
                            },
                            stringLength : {
                                max : 200,
                                message : ' '
                            }
                        }
                    },
                    count: {
                        message: ' ',
                        validators: {
                            notEmpty: {
                                message: ' '
                            },
                            regexp: {/*正则校验*/
                                regexp:  /^\+?[1-9]\d*$/,
                                message: ' '
                            }

                        }
                    },
                    partsName:{
                        message: ' ',
                        validators: {
                            notEmpty: {
                                message: ' '
                            },
                            stringLength : {
                                max : 200,
                                message : ' '
                            }

                        }


                    }
                }
            })
    }
</script>

</body>
</html>